
import java.util.LinkedList;
/**
create by Kingchin Wong on 2016/6/1
*/
public class LList{
	
	public static void main(String[] args){
		//ctor,create a linked ist.
		LinkedList<String> list = new LinkedList<String>();
		//anthor ctor
		//LinkedList<String> list = new LinkedList<String>(n);
		
		//show the size of list.
		System.out.println("the size of list is: " + list.size());
		
		//add elements to list.
		list.add("Jone");
		list.add("Mary");
		list.add("Kingchin");
		
		//show the emelents of list
		System.out.println("list:");
		for(String str:list){
			System.out.println(str);
		}
		
		//show the size of list again
		System.out.println("the size of list is: " + list.size());
		
		//get() method
		for(int index = 0;index < list.size();index++){
			System.out.println("No." + index + " is: " + list.get(index));
		}
		
		//set() method
		int i = 0;
		list.set(i,"Hellen");
		System.out.println("No.0" + " is: " + list.get(i));
	}
	
}